local API_CODE = require "enum.APICode"
local PlayerService = require "modules.player.PlayerService"
local PlayerDB = require "modules.player.PlayerDB"

local M = {}

function M.playerGetInfo(params)
    local playerId = params.playerId
    local player = PlayerService:getPlayerInfo(playerId)
    local getPlayerInfoResultCode = PlayerConst
    if not player then
        player = PlayerDB.getPlayer(playerId)
        if not player then
            return {
                code = -1,
                msg = "User not exists"
            }
        end
    end

    return {
        code = API_CODE.SUCCESS,
        player = player
    }
end

return M
